// 从sessionStorage获取token
export function getToken(): string {
    return sessionStorage.getItem('token') || ''
}

// 将token存储到sessionStorage
export function setToken(token: string): void {
    sessionStorage.setItem('token', token)
}

// 从sessionStorage移除token
export function removeToken(): void {
    sessionStorage.removeItem('token')
}


// 存储动态路由加载状态
export const setDynamicRoutes = (loaded: boolean) => {
  sessionStorage.setItem('routesLoaded', loaded.toString());
};

// 获取动态路由加载状态
export const getDynamicRoutes = (): boolean => {
  return sessionStorage.getItem('routesLoaded') === 'true';
};

// 从sessionStorage移除动态路由
export function removeDynamicRoutes(): void {
    sessionStorage.removeItem('dynamicRoutes')
}